home *** CD-ROM | disk | FTP | other *** search
/ Guide To Cracking 2002 / Guide_to_Cracking_2002.iso / Tutorials / Nag and Time Trial / nag / ns45.txt < prev    next >
Encoding:
Text File  |  2001-02-03  |  6.4 KB  |  136 lines

  1. PROG: Personal Password Vault v 1.0.1
  2. URL: members.aol.com/princesoft
  3. BY: drlan [Me'97/C4N] !
  4. TYPE: 32-bit
  5. PROT: Nag screen with time delay
  6. CHANGES: Output from FC ppv.exe ppb.bak /b
  7.  
  8. Comparing files ppv.exe and ppv.bak
  9. 000271B2: 66 E8
  10. 000271B3: 40 9D
  11. 000271B4: 90 DB
  12. 000271B5: 66 FD
  13. 000271B6: 48 FF
  14. 0003FAD6: 4F 61
  15. 0003FAD7: 54 67
  16.  
  17. This tutorial is more of a request for someone to teach me how to crack this
  18. program's nag screen more elegantly.  I ended up using what I'd consider a
  19. very "dirty" crack.  I'd love for someone to show me a "cleaner" approach to
  20. cracking this nag screen.  Anyway, with a little brute force, here's what I
  21. ended up with...
  22.  
  23. The protection on this program is a nag screen with a timer, very annoying.
  24. So, let's crack this babe!  First I loaded up PPV.EXE in QVPlus to look for
  25. the program's type (32-bit) and to see if there were any interesting imports.
  26. Actually the imports looked garbled and I didn't see anything interesting.
  27.  
  28. I've read elsewhere that nag screens often use the following functions to do
  29. their nasty work:
  30.  
  31. 16-bit          32-bit
  32. MessageBox      MessageBoxA
  33. DialogBox       DialogBoxA
  34.  
  35. This is a 32-bit app, so I tried setting BPX MessageBoxA and BPX DialogBoxA
  36. in SoftICE.  I loaded the program up.  It asked for my password, prior to the
  37. nag.  Then the nag screen loaded up.  Bummer, sICE didn't pop.  So our babe
  38. doesn't use the standard functions to display the box.  Damn.  Now, I'm stuck
  39. because I don't really know how to break on the custom code.  I tried finding
  40. the Window handle and setting a breakpoint on the mouse click once the button
  41. became visible.  To find the right window handle to break on, simply type
  42. HWND in the sICE command window.  It will show you a list of all the windows.
  43. The table is dynamic and takes on a parent/child form.  Look for the one with
  44. PPV (our babe).  Then look for child windows a class name of "Button."  I did
  45. this and set a breakpoint to pop when I clicked the button.  This was done via
  46. BMSG 0378 wm_lbuttondown.  Your window handle number will differ...  My hope
  47. here was to look at the stack to see if I could find the call that brought me
  48. here.  I couldn't...
  49.  
  50. So, I disassembled PPV.EXE with W32Dasm 8.5.  A very nice tool for just such
  51. a job.  Then I clicked on the String Reference button to see if I could find
  52. anything interesting, like perhaps text from the nag screen.  Nope!  In fact,
  53. there really wasn't any interesting text.  Man, there must be an easier way.
  54. I guess the strings aren't there because our babe is compiled with a Borland
  55. product, perhaps C++ or Delphi.  These store strings differently to where they
  56. can't be seen when disassembled.
  57.  
  58. Ok, so it's a Borland product...  Let's use a Borland product to continue the
  59. cracking efforts.  Next I load it up in Borland Resource Workshop 4.5 and have
  60. a look around.  Hmmm, here's something called TFormNag.  One of Fravia's tutes
  61. said I could simply delete the resource and BRW would re-compile for me.  So,
  62. that's what I did.  I deleted the function, exited BRW, saved our babe, and
  63. ran it.  I got a messagebox complaining about "resource TFormNag could not be
  64. found," or something to that effect.  When I clicked ok on the messagebox, the
  65. program popped right up and ran fine.  This looks a little better.
  66.  
  67. Now I set a breakpoint on on MessageBoxA to pop at the error message.  After
  68. dicking around in sICE a little using STACK to see my last few instructions,
  69. I finally found the instruction that called the MessageBoxA function.  The
  70. code (taken from W32Dasm) looks something like this.  If you want to avoid
  71. trying to find this junk yourself, just disable the existing breakpoint.  Then
  72. set a new breakpoint at 0137:00427DB2.  Then run the program.  If sICE doesn't
  73. pop, then you'll need to translate the segment:offset address to a "real" one.
  74. Some of the tutes explain how to do this.  Then you'll have to find the right
  75. segment:offset for your machine.  Again, this is explained in other tutes.
  76.  
  77. * Reference To: user32.MessageBoxA, Ord:0000h
  78. |
  79. :00427DB2 E89DDBFDFF              Call 00405954
  80. :00427DB7 8945FC                  mov dword ptr [ebp-04], eax
  81. :00427DBA 33C0                    xor eax, eax
  82. :00427DBC 5A                      pop edx
  83. :00427DBD 59                      pop ecx
  84. :00427DBE 59                      pop ecx
  85. :00427DBF 648910                  mov dword ptr fs:[eax], edx
  86. :00427DC2 68E07D4200              push 00427DE0
  87.  
  88. I want to skip this call because I know that once the call is done (e.g., I
  89. click on ok), I am taken right into the program.  I know, I know...  I am
  90. cracking the symptom (an error message), not the problem (the actual nag).
  91. Seeing that the call to MessageBoxA is 10 bytes, I don't really want to stick
  92. in 10 NOPs, so I do the +ORC trick: (Type A in the sICE command window to ASM
  93. in the following instructions.  Type ESC when finished.  Then press F5 to run
  94. the program.)
  95.  
  96. A
  97.  
  98. :00427DB2 6640                  inc ax
  99. :00427DB4 90                    nop
  100. :00427DB5 6648                  dec ax
  101.  
  102. ESC
  103.  
  104. F5
  105.  
  106. which leaves :00427DB7 in tact and doesn't introduce too many NOPs (just in
  107. case our babe sniffs them out).
  108.  
  109. I press F5 to continue running and viola, it works fine.  Boy I hope this call
  110. doesn't really do anything else, or I could have just made a big mess.  I did
  111. test out most functions and everything looked ok.
  112.  
  113. Alright now to make a patch.  I start comparing the original file with my now
  114. cracked version and find they are way the hell out of whack.  Remember when I
  115. removed that whole function using BRW, well that took a big bite out of the
  116. code.  So, now there's now way to make a patch.  Damn.
  117.  
  118. So, I return to the original (uncracked) program.  Load it up in a hex editor
  119. and look for TFormNag.  Sure enough, there it is.  I wonder what will happen
  120. if I change the name.  Perhaps it will call our error routine to tell us that
  121. "resource blahblahblah can not be found."  So I change the first occurance of
  122. it to TFormNOT.  Run it.  Yep, there's our error "resource TFormNOT could..."
  123. So now, just patch back in our inc ax, nop, dec ax at the appropriate place.
  124. This can also be done in the hex editor.  Search for the following hex bytes:
  125. 50 E8 9D DB FD FF 89 45 and change the following:
  126.    ^^ ^^ ^^ ^^ ^^
  127.    66 40 90 66 48
  128.  
  129. Now our babe runs much better, without the nag.  But, this is definately not
  130. a "clean" crack.  Would someone please teach me how to crack this thing the
  131. right way?
  132.  
  133. Thanks,
  134.  
  135. drlan [Me'97/C4N] !
  136.